<template>
  <div>
    Child2
    <p>仓库中 count is {{ count }}</p>
    <p>仓库中 double count is {{ doubleCount }}</p>
  </div>
</template>

<script>
import { mapState, mapGetters } from 'vuex'
export default {
  computed: {
    /**
     * 参数1：模块名
     * 参数2： state中的值
     */
    ...mapState('counter', ['count']),
    ...mapGetters('counter', ['doubleCount'])
  },
  mounted () {
    console.log('---state---', this.count)
    console.log('---getters---', this.doubleCount)
  },
  updated () {
    console.log('updated---state---', this.count)
    console.log('updated---getters---', this.doubleCount)
  }
}
</script>
